<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" href="css/reg.css"/>
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/reg.css?v=1.10">
</head>
<style>
    .box1 {
        width: 50%;
        height: 50%;
        margin: auto;
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
    }
</style>
<script src="js/jquery.min.js"></script>
<script>
    $(function () {
        $("button").click(function () {
            var name = ($("#login-username").val())
            var pass = ($("#login-password").val())
            console.log(name)
            console.log(pass)
            if (name == '' || pass == '') {
                alert("请输入用户名或密码")
            } else {
                var obj = {
                    username: name,
                    password: pass,
                }
                $.ajax({
                    url: `http://101.132.141.83:8088/SMSPlatform/login`,//?username=${username}&password=${password}`,
                    //url: `http://localhost:8088/SMSPlatform/login`,//?username=${username}&password=${password}`,
                    type: "POST",
                    contentType: "application/x-www-form-urlencoded;charset=utf-8",
                    //data: JSON.stringify(obj),
                    data: obj,
                    dataType: "text",
                    success: function (result) {
                        console.log(result)
                        if (result == 'success') {
                            alert('登录成功');
                            //location.href = "http://localhost:8088/SMSPlatform/send.html";
                            location.href = "http://101.132.141.83:8088/SMSPlatform/send.html";
                        } else {
                            alert('登录失败');
                            location.reload();
                        }
                    },
                    /*error: function (msg) {
                    console.log(msg)
                    // $(".notice").html('Error:'+msg);
                }*/
                }).fail()
            }

        });
    })
</script>
<body>
<div style="width: 100%;width: 300px;margin: 0 auto;align:center;">
    <div class="box1">
        <h2 align="center">登录</h2>
        <div class="box1">
            用户名：<input id="login-username" type="text" align="center"><br><br>
            密 &nbsp;&nbsp;码：<input id="login-password" type="password" align="center"><br><br>
            <button @click="login()">提交</button>
        </div>
    </div>
</div>
</body>
</html>